
'Protoc文件根目录
const ResourceRoot = null  
'保存目标根目录
const TargetRoot = "E:\svn\XLSVN\OpenSource\XLProtobuf\protobuf3\bin\Debug\Protos\OUT2"	 


'================================================================================================
'工具所在目录
const ProtocToCsharp = "E:\svn\XLSVN\Code\Solutions\ProtocToCSharp\bin\Debug\netcoreapp3.1"
const ProtocToCsharpExeName = "ProtocToCSharp.exe"
const ProtocExeName = "protoc.exe"
const IsDebug = false
const IsAutoExit = true	






'下面这些不要改=========================================================================================================
dim m_ResourceRoot
dim m_TargetRoot


vbspath = createobject("Scripting.FileSystemObject").GetFolder(".").Path



if isnull(ResourceRoot) or isempty (ResourceRoot) or ResourceRoot = "" then
	m_ResourceRoot = vbspath
else
	m_ResourceRoot = ResourceRoot
end if

if isnull(TargetRoot) or isempty (TargetRoot) or TargetRoot = "" then
	m_TargetRoot = m_ResourceRoot
else
	
    m_TargetRoot = TargetRoot
end if

dim wshshell
set wshshell = createobject("wscript.shell")

dim cmd 
cmd = "CMD /c" & GetDickSign        & " & "
cmd = cmd       &                      """" & ProtocToCsharp  & "\"   & ProtocToCsharpExeName & """"
cmd = cmd       & " --root_path="    & """" & m_ResourceRoot                                  & """"
cmd = cmd       & " --build_exe="    & """" & ProtocToCsharp  & "\"   & ProtocExeName         & """"
cmd = cmd       & " --out_path="     & """" & m_TargetRoot                                    & """"
cmd = cmd       & " --run_exit="     & """" & IsAutoExit                                      & """"
cmd = cmd       & " --debug="        & """" & IsDebug                                         & """"
wshshell.run cmd
'SetClipboardText cmd



'========================================
function GetDickSign()
    GetDickSign = left(ProtocToCsharp,2)
end function



Sub SetClipboardText(Text)   '写入信息到剪切板
	set ws=createobject("wscript.shell")
	
	t = replace(Text,"""","""""")
	ws.run "mshta vbscript:ClipBoardData.setData(""Text"",""" & t & """)(window.close)", 0, true
End Sub


